package br.com.duosoftware.orcamento.daos;

import br.com.duosoftware.orcamento.entidades.PlanoDeConta;
import br.com.duosoftware.orcamento.entidades.TipoOrgao;
import java.util.List;

/**
 *
 * @author Renato
 *
 */
public class PlanoDeContaDAO extends DAOGenerico {

    public void salvarOuAtualizar(PlanoDeConta planoDeConta) {
        salvarOuAtualizarPojo(planoDeConta);
    }

    public void excluir(PlanoDeConta planoDeConta) {
        excluirPojo(planoDeConta);
    }

    public PlanoDeConta getPlanoDeContaPorId(long id) {
        return getPojo(PlanoDeConta.class, id);
    }

    public List<PlanoDeConta> listarPlanosDeConta() {
        return getPojos("FROM PlanoDeConta planoDeConta "
                + "ORDER BY planoDeConta.id");
    }

    public List<PlanoDeConta> listarPlanosDeConta(Integer nivel, Integer codigo) {
        return getPojos("FROM PlanoDeConta planoDeConta "
                + "WHERE planoDeConta.nivel.codigo = ? "
                + "AND planoDeConta.codigo LIKE ?",
                String.valueOf(nivel), String.valueOf(codigo) + "%");
    }
    
}
